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

Query time 0.00022