UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e/QtG072y2qvVuj/FItl9NRzoCo6zeWcx6DfP+5sDNU=' 
WHERE 
  key_id = '3f452ae587f0f1fced88455294be0658519e38b7cb87323e532acddbce76c9c5' 
  AND (
    token = 'e/QtG072y2qvVuj/FItl9NRzoCo6zeWcx6DfP+5sDNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038