UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XzI0CDWJWF+MQ5NQaT4BqghPHnnf176IY1LIAHyPe+Y=' 
WHERE 
  key_id = '27722e2fec97beac001a269b14fc1e8e8a60b640a495cbe0fce0b9909eb5e6b0' 
  AND (
    token = 'XzI0CDWJWF+MQ5NQaT4BqghPHnnf176IY1LIAHyPe+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016