UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xCLbsIEIg+q1KtXMK3fOoxpRP5w6eHSEEXLrFxulYGM=' 
WHERE 
  key_id = 'c7d24f93a9f2147e1639b30ce1f14295ea9931dd2e2eb376d03918d3f8cc0991' 
  AND (
    token = 'xCLbsIEIg+q1KtXMK3fOoxpRP5w6eHSEEXLrFxulYGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023