UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GUuWCp2o44Z2Pnfo1FYd4P9xQ1srVgTP/1EAuIbC140=' 
WHERE 
  key_id = 'ed8d860e64ff30e8741c5a4518709982124af87fd7bb19c8df70b03686b96005' 
  AND (
    token = 'GUuWCp2o44Z2Pnfo1FYd4P9xQ1srVgTP/1EAuIbC140=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032