UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V1yJQixEbAd6hrPMd8PKI3nobmkAlR6v5l1NgGru2nI=' 
WHERE 
  key_id = '7221cd923b5072b5dc354f7cdf7c2748601e448cc16ad16c953d2d8de730b922' 
  AND (
    token = 'V1yJQixEbAd6hrPMd8PKI3nobmkAlR6v5l1NgGru2nI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035