UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0u4GccyA7Givp9zVZahuaxlv4IAPfmayRwzrOESbpOQ=' 
WHERE 
  key_id = '321225951301aaf5c7a3fc07e333fd0151407bb54dbc6784c83b1dbd5c94713b' 
  AND (
    token = '0u4GccyA7Givp9zVZahuaxlv4IAPfmayRwzrOESbpOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033