UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'azy05s8CEq8nc1+PtLsxwjoq+8Si7sav8E8zzn25ANA=' 
WHERE 
  key_id = '05e8826ed8e7f7d4234d0a9f7fe8ccdd8d01d0c7d5cabca83739f83801f9dc6a' 
  AND (
    token = 'azy05s8CEq8nc1+PtLsxwjoq+8Si7sav8E8zzn25ANA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048