UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'foI+NTHqonoXuWM4Zvdi8QoIcRNYFptl2yZJqUuhKbE=' 
WHERE 
  key_id = '20a00f0fbc85dc44cfb5b161a4f7cc37f3c3b305c717f0f0a3e254bdc08e25e8' 
  AND (
    token = 'foI+NTHqonoXuWM4Zvdi8QoIcRNYFptl2yZJqUuhKbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032