UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yZrN9yLGeu7g4UaQyOotBPMBOdCJlqnoq7ggVcCE8Us=' 
WHERE 
  key_id = '386daa2dd2842ece15ed5c421958397702acdd00c401c8d5c59da721aad0aaa0' 
  AND (
    token = 'yZrN9yLGeu7g4UaQyOotBPMBOdCJlqnoq7ggVcCE8Us=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022