UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VrfTpAqo9N26knof3+3f5Wqtwnb4MsdOkssmCRsIhCg=' 
WHERE 
  key_id = '22d3d56042dddb4e68d8a50136070bd94bb861d625c80bfed473c80dfacaa884' 
  AND (
    token = 'VrfTpAqo9N26knof3+3f5Wqtwnb4MsdOkssmCRsIhCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027