UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+nWc1swwY/Mxdp+lKeTxbOTx8svz1qTc7jkRfqDRwr8=' 
WHERE 
  key_id = '31ca3f17d64cac538e86196e5af86266a670a09c081dd9bbb50499219e7117d3' 
  AND (
    token = '+nWc1swwY/Mxdp+lKeTxbOTx8svz1qTc7jkRfqDRwr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032