UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hvU0Xaf9WHmg7B5c8UnSPPo1lig3DszsBXgcNlW2PqU=' 
WHERE 
  key_id = 'a6a5931e51513fe23bada20d82b1cc8a1958678f8d9fbb95278e40a3138b2050' 
  AND (
    token = 'hvU0Xaf9WHmg7B5c8UnSPPo1lig3DszsBXgcNlW2PqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034