UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vfbjCmSVCs7Yqe7yxlrlB5LFXaNlfmr2Y33jOVJxGbI=' 
WHERE 
  key_id = '5213d2bbd0d030c7d1d63527fce3a3ff7610e5b0051a0220d4fd22fc56478082' 
  AND (
    token = 'vfbjCmSVCs7Yqe7yxlrlB5LFXaNlfmr2Y33jOVJxGbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024