UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmHSBgAyHiuNZ5TK00bziIjli4owsdKGJHdZYjKDiq8=' 
WHERE 
  key_id = '0271711f9b5f5564dc24f0d97084fb61393221d5c4b8943fe76f12ee4e6c8442' 
  AND (
    token = 'jmHSBgAyHiuNZ5TK00bziIjli4owsdKGJHdZYjKDiq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058