UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cJ1TE54n0/JKrkpR2kq1FRVxniFKsvqa8yk1FLxq9rw=' 
WHERE 
  key_id = '22d193dfc8f49d42404f6fcea7839a47b946abbfc8cf125222e419c58b102618' 
  AND (
    token = 'cJ1TE54n0/JKrkpR2kq1FRVxniFKsvqa8yk1FLxq9rw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055