UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THElFB2XO5m9lPnWxdlsedvUyyOqkS+IgqSWmpjIqAA=' 
WHERE 
  key_id = 'eb4316fac518f501067efaa8c2f825c86e64dc01baa4d2dee342ff6b67625255' 
  AND (
    token = 'THElFB2XO5m9lPnWxdlsedvUyyOqkS+IgqSWmpjIqAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043