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

Query time 0.00027