UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8trEArmBfOED4BPtL47okQZLQJwNHiH0ThmR38ETgnQ=' 
WHERE 
  key_id = '7147a8de5d668c2460ab567aa700316884748c441f2ffa59f9a6e0490cb7f845' 
  AND (
    token = '8trEArmBfOED4BPtL47okQZLQJwNHiH0ThmR38ETgnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047