UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WuTs/TttLnY1X+X8UcnrZutxw37XtWS1e5POK/nBYdA=' 
WHERE 
  key_id = '90c6c9b040447de2e2aaba950daec787a66216b0f648d7f6c22815440809e422' 
  AND (
    token = 'WuTs/TttLnY1X+X8UcnrZutxw37XtWS1e5POK/nBYdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033