UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OX3Mt0kUqWm9vB9NrKnVmbjFRn0GDWwnRZUDKYtDJtU=' 
WHERE 
  key_id = '9ed82588010c62d0264264b261c2f456e730982c490000edf7c9e36292f49077' 
  AND (
    token = 'OX3Mt0kUqWm9vB9NrKnVmbjFRn0GDWwnRZUDKYtDJtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039