UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gH6rx5jPf1eB2ONJ2+WGrZlOLbFaG7stXWs4oltOJJA=' 
WHERE 
  key_id = '1d74cef48ddd2a0a52b11d8fdea49eac7272a295838ea934629da4cf0fe27772' 
  AND (
    token = 'gH6rx5jPf1eB2ONJ2+WGrZlOLbFaG7stXWs4oltOJJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043