UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ax8IXW7+wfwgqdNM/O/wtw2kh7u+PwTAQ4QAI0/ByiQ=' 
WHERE 
  key_id = '109efafb730531279214085ee67cbb94aeb15e40f78be136807d57ee2d88d368' 
  AND (
    token = 'Ax8IXW7+wfwgqdNM/O/wtw2kh7u+PwTAQ4QAI0/ByiQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022