UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MOiL8GRxgOe+DpPx6dw/vbieq3JPdxWGNFhKUf7Iy7Q=' 
WHERE 
  key_id = '6e51def19c7eabc80d15e1da8b848975d5838ad1a71dcf55e0d69038799baf57' 
  AND (
    token = 'MOiL8GRxgOe+DpPx6dw/vbieq3JPdxWGNFhKUf7Iy7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036