UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0yRsIuR8mdMCDvXWOO0/xUYyw7u8m7W+/BTx2SRBd9M=' 
WHERE 
  key_id = 'f4249399352103f3aea8502e79d59a729223d4345fc068f13a35e7f2b2703ea4' 
  AND (
    token = '0yRsIuR8mdMCDvXWOO0/xUYyw7u8m7W+/BTx2SRBd9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040