UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f2Cks2LVWFICKjbi6Wbs+ym/B17rPWXssxyrd8TLYZk=' 
WHERE 
  key_id = '3795be6e67b073a8d8b7d7436c5aeb9155a6fe4881a4284d16f5df7284bb0b8d' 
  AND (
    token = 'f2Cks2LVWFICKjbi6Wbs+ym/B17rPWXssxyrd8TLYZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035