UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cwiz5n0rxq+ffCCmU/t9ZFPWdSpnuNUnlU7sByEnT9I=' 
WHERE 
  key_id = '8409420faa9652f8583c547215b922b2db135e6dfbf80151382580e3df29ee0f' 
  AND (
    token = 'cwiz5n0rxq+ffCCmU/t9ZFPWdSpnuNUnlU7sByEnT9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026