UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sXNBRBSXjvMRdAZqZ+vMtuxPW2cPZskCdGAHqM2BtII=' 
WHERE 
  key_id = '523eb692acfc6c13da99dfa46ebc61097c591838c78a5b98365a846f5d973e5d' 
  AND (
    token = 'sXNBRBSXjvMRdAZqZ+vMtuxPW2cPZskCdGAHqM2BtII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021