UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wO+4WvRe+mqyMiJiKgVhClFOOcL2pca+Dcxgpahn16s=' 
WHERE 
  key_id = '465220e8e3deb74fc15a84c5ad5364eb0e9a9d3437b24b1f70757f3a3391bd41' 
  AND (
    token = 'wO+4WvRe+mqyMiJiKgVhClFOOcL2pca+Dcxgpahn16s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050