UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SCfnd9hSJJshrtG9GazwrI1KlZrcXIx6704Eg7Q1v/4=' 
WHERE 
  key_id = '2914cf32b2f6631679e0c9f6d5059f253fd8450cbd43d022d3867eccaf42e10a' 
  AND (
    token = 'SCfnd9hSJJshrtG9GazwrI1KlZrcXIx6704Eg7Q1v/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028