UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NukClBrzThgwFMZT3RnFBuz+rsHeZSRLXrjUz9zoS84=' 
WHERE 
  key_id = 'aaf950c26755165fbe87b0379c609e3b5981ea90523415122ae5b31d1e42805b' 
  AND (
    token = 'NukClBrzThgwFMZT3RnFBuz+rsHeZSRLXrjUz9zoS84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038