UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GC7h8LwteKUFkLedGSxe05JB/cAHV0DjSUgzJ9Nsyz4=' 
WHERE 
  key_id = '65f2eb6f9954e6e9012e2a7f3decb8cff26c21008443e938553fdb4bd6bfb38a' 
  AND (
    token = 'GC7h8LwteKUFkLedGSxe05JB/cAHV0DjSUgzJ9Nsyz4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028