UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7UyHCPYCTC+mEkyAgH4mzD3B5HtntrfRqXySDutDNpg=' 
WHERE 
  key_id = 'd8f9fef44592bf8a595a37431ec1c31d65a5b0eb11867d8f502493c1cc66a83b' 
  AND (
    token = '7UyHCPYCTC+mEkyAgH4mzD3B5HtntrfRqXySDutDNpg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042