UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZoaBec53oMAL4rE/VG3eq+fmxJtuzlLzN1cVqdGkLm8=' 
WHERE 
  key_id = '40d37bb7ef716c6974d6d2e65ee08daf254938ea3eaa2e27a6d9e325e28190f8' 
  AND (
    token = 'ZoaBec53oMAL4rE/VG3eq+fmxJtuzlLzN1cVqdGkLm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030