UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BH4a2Lqtn5EIcOIbBlGBDXJ1cNYqCCrO+gQBkhjAKAU=' 
WHERE 
  key_id = '9ed3fd534ad7ca0addf07c897283b38d287b448ed4647530137330f047718c4d' 
  AND (
    token = 'BH4a2Lqtn5EIcOIbBlGBDXJ1cNYqCCrO+gQBkhjAKAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044