UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+Hve3QNunU9gONC4jIxyXwNmYNzq27fJKU80G0RZfU=' 
WHERE 
  key_id = '35ae47fe15829763d9128cfba5478102082bc3d4f3d776a82ab6b9d82f362db6' 
  AND (
    token = 'D+Hve3QNunU9gONC4jIxyXwNmYNzq27fJKU80G0RZfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023