UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1hXptUgw9cynaHx3a6v8KSm+KGEOC2Wp6l43FypGABo=' 
WHERE 
  key_id = 'a23ed21d83b9907de194dad0a735c984847e00c418955826f6d3e56ffc5ee11b' 
  AND (
    token = '1hXptUgw9cynaHx3a6v8KSm+KGEOC2Wp6l43FypGABo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035