UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lK1InjivzyR7ztNoa3ZRsUGsACmryttPnPiVjLEOheA=' 
WHERE 
  key_id = '581ee0578f21443c9b5201aee5256b6d4b3e0e054b0609d46bdb4be0d8925f8e' 
  AND (
    token = 'lK1InjivzyR7ztNoa3ZRsUGsACmryttPnPiVjLEOheA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020