UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'it2V9QNvTt1yOVFvpg+Ajb+qjuS6ylt3nHpAxXuH8dM=' 
WHERE 
  key_id = '6d068b4e1acd050e134bb130a8753bb6bd9e2f7ee37bcc49c362b3e353411164' 
  AND (
    token = 'it2V9QNvTt1yOVFvpg+Ajb+qjuS6ylt3nHpAxXuH8dM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023