UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5of9IPa7VBBNXe3wqkiAk1JdEbn61CdTIFgu4Vy+5Y=' 
WHERE 
  key_id = '8abd4acc5dcbeb980d8e131bfb985f2502473df20b61178aa0467438e82cfad5' 
  AND (
    token = 'A5of9IPa7VBBNXe3wqkiAk1JdEbn61CdTIFgu4Vy+5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028