UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AB4y7PbSHT4tdl+DVFaDuGmw6/QqoHg2cIlNhm2lwRM=' 
WHERE 
  key_id = '9b5dfeefdbc932863e0e331de78bddf61335b84603e4da90eeadc9cc4a06b4ea' 
  AND (
    token = 'AB4y7PbSHT4tdl+DVFaDuGmw6/QqoHg2cIlNhm2lwRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030