UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nBKW8ibBogIn9veOQ5yMgZHbhXQvoZczUlfMXktRATk=' 
WHERE 
  key_id = '5da2189579d174f93e48fdb724b617e8896ebbadad144a440eaf534830324e10' 
  AND (
    token = 'nBKW8ibBogIn9veOQ5yMgZHbhXQvoZczUlfMXktRATk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024