UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6PVW15c6cf34qrgla69Uu/YvFUDS59HyS1jcOzI0bL8=' 
WHERE 
  key_id = 'ec82d5b4ef5c684c576565c2206e6ee6ba9a52b83fbd53ccac9d5975edcf5fa8' 
  AND (
    token = '6PVW15c6cf34qrgla69Uu/YvFUDS59HyS1jcOzI0bL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034