UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tilW4jPQLwf87ODcEwnA6WJLCDN2baKxY+TyCoNo01A=' 
WHERE 
  key_id = '85a757e69d5882d7e6617fee1a827f548986ba345320c61bcdcc81fea3c87131' 
  AND (
    token = 'tilW4jPQLwf87ODcEwnA6WJLCDN2baKxY+TyCoNo01A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024