UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B6dt7+MkFIrMjH+CCtdfbWwVyRglcMj16aTUww0S0Pg=' 
WHERE 
  key_id = '48278179c456a4160ba191409625c894a78be9d5374ae7dac8bb31a0f97d8689' 
  AND (
    token = 'B6dt7+MkFIrMjH+CCtdfbWwVyRglcMj16aTUww0S0Pg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041