UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oOrwJCB67xzZv3qVuocS4BNV8u5kSAFzdc8y5aqnV5w=' 
WHERE 
  key_id = '572a7fb9fe7fe68c531e01c7fdffb85e7656d4b3c5324e25fe5a77543dda790e' 
  AND (
    token = 'oOrwJCB67xzZv3qVuocS4BNV8u5kSAFzdc8y5aqnV5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041