UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Az0Wa75QTs24hg9xn1f8mtfAFQyVZsgAZqoRBMFohmQ=' 
WHERE 
  key_id = '2bb864fdc388506fda61324241d2cc694fb111cf0eb54994fc504b728f144ff6' 
  AND (
    token = 'Az0Wa75QTs24hg9xn1f8mtfAFQyVZsgAZqoRBMFohmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033