UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0//KgD2J4DZcXH5/49Ie6WtuDF9CN6UPEy7cA9ssP0Q=' 
WHERE 
  key_id = '331d9d3c4578381e1e37eea9406ea0cc66eb4fd1a36c9d3060a0f510ebe12fc6' 
  AND (
    token = '0//KgD2J4DZcXH5/49Ie6WtuDF9CN6UPEy7cA9ssP0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038